home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / queues.exe / CREATQ.C next >
Text File  |  1992-01-13  |  7KB  |  165 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.  *                                                                           *
  3.  *                                                                           *
  4.  Program : CREATQ.C
  5.  Date    : 05/20/91
  6.  Function: CREATQ creates a queue on the current server.
  7.  Genesis : Turbo C 2.0
  8.            Compiled in Turbo C environment with defaults under DOS 3.3.
  9.  
  10.  This software is provided as is and carries no warranty
  11.  whatsoever.  Novell disclaims and excludes any and all implied
  12.  warranties of merchantability, title and fitness for a particular
  13.  purpose.  Novell does not warrant that the software will satisfy
  14.  your requirements or that the software is without defect or error
  15.  or that operation of the software will be uninterrupted.  You are
  16.  using the software at your risk.  The software is not a product
  17.  of Novell, Inc. or any of subsidiaries.
  18.  *                                                                           *
  19.  *                                                                           *
  20.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  21. #include <stdio.h>
  22. #include <string.h>
  23. #include <dos.h>
  24. #include <nit.h>
  25. #include <niterror.h>
  26. #include <nitq.h>
  27.  
  28. #define INT21            0x21
  29. #define OT_TEST_SERVER   0x8010
  30. #define OT_TEST_QUEUE    0x8020
  31. #define SEGMENT1         0x01
  32. #define NO_MORE_SEGMENTS 0x00
  33.  
  34. char GetCurrentDrive (void) ;
  35. void main (void);
  36.  
  37. struct {
  38.     BYTE accountExpirationDate[3] ;
  39.     BYTE accountDisabledFlag ;
  40.     BYTE passwordExpirationDate[3] ;
  41.     BYTE graceLogin ;
  42.     WORD passwordExpirationIntervals ;
  43.     BYTE graceLoginResetValue ;
  44.     BYTE minPasswordLength ;
  45.     WORD maxConcurrentConnections ;    
  46.     BYTE allowedLoginTimeBitmap[42] ;
  47.     BYTE lastLoginDateTime[6] ;
  48.     BYTE restrictionFlags ;
  49.     BYTE unused ;
  50.     long maxDiskUsageInBlocks ;
  51.     WORD badLoginCount ;
  52.     long nextResetTime ;
  53.     BYTE badLoginAddr[12] ;
  54. } loginControl;
  55.  
  56. void main(void) {
  57.     int  cCode;
  58.     long queueID;
  59.     BYTE drive ;
  60.     BYTE statusFlags;
  61.     BYTE dirHandle;
  62.     WORD fileServerConnectionID;
  63.  
  64.     drive = GetCurrentDrive() ;
  65.     statusFlags = GetDriveInformation (drive,
  66.                                        &fileServerConnectionID,
  67.                                        &dirHandle);
  68.  
  69.   if (cCode = CreateBinderyObject ("CHRIS_SERVER",
  70.                                    OT_TEST_SERVER,
  71.                                    BF_STATIC,
  72.                                    BS_ANY_READ|BS_ANY_WRITE))
  73.     printf ("\nError Creating Object.  Error: %d\n", cCode);
  74.   else
  75.     printf ("\nObject Created.");
  76.   if (cCode = ChangeBinderyObjectPassword ("CHRIS_SERVER",
  77.                                            OT_TEST_SERVER,
  78.                                            "",
  79.                                            "CHRISERVER"))
  80.      printf ("\nError Changing Password.  Error: %d\n", cCode);
  81.   else
  82.     printf ("\nPassword Created.");
  83.   if (cCode = CreateProperty ("CHRIS_SERVER",
  84.                               OT_TEST_SERVER,
  85.                               "LOGIN_CONTROL",
  86.                               BF_STATIC|BF_ITEM,
  87.                               BS_OBJECT_READ|BS_OBJECT_WRITE))
  88.      printf ("\nError Creating Property.  Error: %d\n", cCode);
  89.   else
  90.     printf ("\nProperty Created.");
  91.   memset (loginControl.allowedLoginTimeBitmap, 0xFF,
  92.           sizeof (loginControl.allowedLoginTimeBitmap));
  93.   loginControl.minPasswordLength=5;
  94.   if (cCode = WritePropertyValue ("CHRIS_SERVER",
  95.                                   OT_TEST_SERVER,
  96.                                   "LOGIN_CONTROL",
  97.                                   SEGMENT1,
  98.                                   (BYTE *)&loginControl,
  99.                                   NO_MORE_SEGMENTS))
  100.     printf ("\nError Writing Property Value.  Error: %d\n", cCode);
  101.   else printf ("\nProperty Written.");
  102.   if (cCode = CreateProperty ("CHRIS_SERVER",
  103.                               OT_TEST_SERVER,
  104.                               "SECURITY_EQUALS",
  105.                               BF_STATIC|BF_SET,
  106.                               BS_OBJECT_READ|BS_OBJECT_WRITE))
  107.      printf ("\nError Creating Property.  Error: %d\n", cCode);
  108.   else printf ("\nProperty Created.");
  109.   if (cCode = AddBinderyObjectToSet ("CHRIS_SERVER",
  110.                                      OT_TEST_SERVER,
  111.                                      "SECURITY_EQUALS",
  112.                                      "SUPERVISOR",
  113.                                      OT_USER))
  114.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  115.   else printf ("\nObject Added to Set.");
  116.   if (cCode = AddBinderyObjectToSet ("CHRIS_SERVER",
  117.                                      OT_TEST_SERVER,
  118.                                      "SECURITY_EQUALS",
  119.                                      "EVERYONE",
  120.                                      OT_USER_GROUP))
  121.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  122.   else printf ("\nObject Added to Set.");
  123.  
  124.   if (cCode = CreateQueue ("CHRIS_QUEUE",
  125.                            OT_TEST_QUEUE,
  126.                            dirHandle,
  127.                            "",
  128.                            &queueID))
  129.     printf ("\nError %d creating queue", cCode);
  130.   else printf ("\nQueue created.");
  131.  
  132.   if (cCode = AddBinderyObjectToSet ("CHRIS_QUEUE",
  133.                                      OT_TEST_QUEUE,
  134.                                      "Q_USERS",
  135.                                      "COJEDA",
  136.                                      OT_USER))
  137.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  138.   else printf ("\nObject Added to Set.");
  139.  
  140.   if (cCode = AddBinderyObjectToSet ("CHRIS_QUEUE",
  141.                                      OT_TEST_QUEUE,
  142.                                      "Q_OPERATORS",
  143.                                      "COJEDA",
  144.                                      OT_USER))
  145.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  146.   else printf ("\nObject Added to Set.");
  147.  
  148.   if (cCode = AddBinderyObjectToSet ("CHRIS_QUEUE",
  149.                                      OT_TEST_QUEUE,
  150.                                      "Q_SERVERS",
  151.                                      "CHRIS_SERVER",
  152.                                      OT_TEST_SERVER))
  153.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  154.   else printf ("\nObject Added to Set.");
  155. }
  156.  
  157. char GetCurrentDrive () {
  158.     union REGS reg ;
  159.     struct SREGS segs ;
  160.  
  161.     reg.h.ah = 0x19 ;
  162.     int86x(INT21,®,®,&segs) ;
  163.     return(reg.h.al) ;
  164. }
  165.